package com.upup.train_management.config;

import org.springframework.web.servlet.view.InternalResourceViewResolver;

// 暂时禁用此配置类，避免与 Thymeleaf 冲突
// @Configuration
public class ViewResolverConfig {

    /**
     * 禁用默认的 InternalResourceViewResolver 以避免与 Thymeleaf 冲突
     * 通过设置高优先级和空的视图类来有效禁用它
     */
    // @Bean
    public InternalResourceViewResolver internalResourceViewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        // 设置最低优先级，确保 Thymeleaf 解析器先执行
        resolver.setOrder(Integer.MAX_VALUE);
        // 设置空的前缀和后缀，使其无法解析任何视图
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        // 设置为不缓存，避免干扰
        resolver.setCache(false);
        return resolver;
    }
}
